<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page import="com.demo2do.core.utils.DateUtils"%>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
<title>飞腾会-FitaClub</title>
<%@ include file="/WEB-INF/include/meta.jsp"%>
<%@ include file="/WEB-INF/include/css.jsp"%>
</head>
<!-- end header -->

<body>
  <div class="page-group">
    <div class="page page-current bg-light-gray">
      <header class="bar bar-nav fita-header">
        <a href="javascript:history.back(-1);" class="icon icon-left pull-left"></a>
        <a class="icon icon-menu pull-right open-panel"></a>
        <h1 class="title">我的订单</h1>
      </header>
      <div class="content">
        <div class="buttons-tab fixed-tab fita-buttons-tab" data-offset="54">
<%--           <a href="${ctx.host}/orders?status=STAYING" class="active button">保留预定</a>
 --%>          <a href="${ctx.host}/orders?status=UNPAID" class="button">待支付</a>
          <a href="${ctx.host}/orders?status=PAID" class="button">已支付</a>
          <a href="${ctx.host}/orders?status=CONSUMED" class="button">已完成</a>
        </div>
      
        <div class="list order-list-layout">
        	
        	<c:forEach items="${orders}" var="order">
        		<div class="card fita-card">
		            <div class="card-content">
		              <div class="card-content-inner">
		                <a href="${ctx.host}/orders/${order.id}">
		                  <div class="row no-gutter cars-detail">
		                    <div class="col-33 cars-type">
		                      <img src="${order.details.carInfo.picture}" />
		                    </div>
		                    <div class="col-66 price-box">
		                      <div class="location">
		                        <div class="item">
		                          <p>${order.pickupLocation}</p>
		                          <span class="time"><fmt:formatDate value="${order.pickupDate}" pattern="MM-dd HH:mm"/></span>
		                        </div>
		                        <div class="item day"><p class="no-margin">${order.rentDay}天</p></div>
		                        <div class="item">
		                          <p>${order.returnLocation }</p>
		                          <span class="time"><fmt:formatDate value="${order.returnDate}" pattern="MM-dd HH:mm"/></span>
		                        </div>
		                      </div>
		                      <div class="" style="margin-top: .5rem;">
		                        <p class="no-margin">使用人: ${order.customerName} ${order.customerPerfix}</p>
		                        <p class="no-margin">Email:${order.customerEmail }</p>
		                      </div>
		                    </div>
		                  </div>
		                  
		                  <div class="row">
		                    <div class="col-25">${order.vehicleBrand}<br>或类似车型</div>
		                    <div class="col-75 text-right">
                          <c:set var="exchangeRate" value="${persist.exchangeRate(order.currencyCode)}"/>
		                      <p class="no-margin">订单金额：<div class="current-price">￥<fmt:formatNumber value="${not empty order.distributionRewardRecord ? order.decimalPayPrice(exchangeRate.rate) + order.distributionRewardRecord.amount/100 :  order.decimalPayPrice(exchangeRate.rate)}" type="number" maxFractionDigits="2" pattern="0.00"/></div></p>
		                      <p class="no-margin" style="font-size:13px;">最晚支付日期：<fmt:formatDate value="${order.payEndDate}" pattern="yyyy年MM月dd日 HH:mm"/></p>
		                    </div>
		                  </div>
		                </a>
		                
                    <div class="clearfix text-right">
                    
<%--                       <c:if test="${order.isCouldCancelBooking() }">
                      	<a href="javascript:void(0);" data-href="${ctx.host}/orders/${order.id}/cancel-booking" data-order="${order.id}" data-agent="${order.agent.mobile}" class="order-button cancelBooking">取消预定</a>
                      </c:if>
                      <c:if test="${!order.isCouldCancelBooking()}">
                    	<a href="javascript:void(0);" class="order-cancel" >取消预定</a>
                      </c:if> --%>
                      <a href="${ctx.host}/shopping/result?type=pay&orderId=${order.id}" class="order-button" style="">立即支付</a>
                    </div>
		              </div>
		            </div>
          		</div>
        	</c:forEach>
        
        </div>
      </div>
    </div>
    
    <div class="panel-overlay"></div>
    <div class="panel panel-right panel-cover fita-panel">
      <div class="list-block contacts-block no-margin">
        <p class="menu-title close-panel">关闭</p>
          <ul>
            <li>
              <a href="${ctx.host}/cars/search" class="item-content item-link">
                <div class="item-inner">
                  <div class="item-title">立即租车</div>
                </div>
              </a>
            </li>
            <li>
	            <a href="${ctx.host}/profile" class="item-content item-link">
	              <div class="item-inner">
	                <div class="item-title">个人中心</div>
	              </div>
	            </a>
	          </li>
          </ul>
      </div>
    </div>
  </div>
  <a ctx.host="/orders/orders-detail">订单详情页</a>
	 
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/order/order-list.js" />
  <script type="text/javascript">
  require(['page/order/order-list'], function(page) {
    page.init()
  })
  </script>

 
</body>
</html>